package com.spic.business.detector.service.impl;

import com.spic.business.detector.domain.HkSmokeDetector;
import com.spic.business.detector.mapper.HkSmokeDetectorMapper;
import com.spic.business.detector.service.IHkSmokeDetectorService;
import com.spic.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 海康烟感报警Service业务层处理
 *
 * @author spic
 * @date 2022-04-15
 */
@Service
public class HkSmokeDetectorServiceImpl implements IHkSmokeDetectorService
{
    @Autowired
    private HkSmokeDetectorMapper hkSmokeDetectorMapper;

    /**
     * 查询海康烟感报警
     *
     * @param indexCode 海康烟感报警主键
     * @return 海康烟感报警
     */
    @Override
    public HkSmokeDetector selectHkSmokeDetectorByIndexCode(String indexCode)
    {
        return hkSmokeDetectorMapper.selectHkSmokeDetectorByIndexCode(indexCode);
    }

    /**
     * 查询海康烟感报警列表
     *
     * @param hkSmokeDetector 海康烟感报警
     * @return 海康烟感报警
     */
    @Override
    public List<HkSmokeDetector> selectHkSmokeDetectorList(HkSmokeDetector hkSmokeDetector)
    {
        return hkSmokeDetectorMapper.selectHkSmokeDetectorList(hkSmokeDetector);
    }

    /**
     * 新增海康烟感报警
     *
     * @param hkSmokeDetector 海康烟感报警
     * @return 结果
     */
    @Override
    public int insertHkSmokeDetector(HkSmokeDetector hkSmokeDetector)
    {
        hkSmokeDetector.setCreateTime(DateUtils.getNowDate());
        return hkSmokeDetectorMapper.insertHkSmokeDetector(hkSmokeDetector);
    }

    /**
     * 修改海康烟感报警
     *
     * @param hkSmokeDetector 海康烟感报警
     * @return 结果
     */
    @Override
    public int updateHkSmokeDetector(HkSmokeDetector hkSmokeDetector)
    {
        hkSmokeDetector.setUpdateTime(DateUtils.getNowDate());
        return hkSmokeDetectorMapper.updateHkSmokeDetector(hkSmokeDetector);
    }

    /**
     * 批量删除海康烟感报警
     *
     * @param indexCodes 需要删除的海康烟感报警主键
     * @return 结果
     */
    @Override
    public int deleteHkSmokeDetectorByIndexCodes(String[] indexCodes)
    {
        return hkSmokeDetectorMapper.deleteHkSmokeDetectorByIndexCodes(indexCodes);
    }

    /**
     * 删除海康烟感报警信息
     *
     * @param indexCode 海康烟感报警主键
     * @return 结果
     */
    @Override
    public int deleteHkSmokeDetectorByIndexCode(String indexCode)
    {
        return hkSmokeDetectorMapper.deleteHkSmokeDetectorByIndexCode(indexCode);
    }
}
